<template>
  <div class="search">
    <f-form ref="form" :action="api.config" :form-key="this.formItem.configId" >
      <f-form-item label="图文配置名称"  name="configName" dataType="${formField.dataType}"   :value="formItem.configName" />
      <f-form-item label="图文配置轮播图"  name="configImg" dataType="${formField.dataType}"   :value="formItem.configImg" />
      <f-form-item label="配置内容"  name="content" dataType="${formField.dataType}"   :value="formItem.content" />
      <f-form-item label="跳转路径"  name="pathUrl" dataType="${formField.dataType}"   :value="formItem.pathUrl" />
      <f-form-item label="配置code"  name="configCode" dataType="${formField.dataType}"   :value="formItem.configCode" />
      <f-form-item label="说明"  name="remark" dataType="${formField.dataType}"   :value="formItem.remark" />
      <f-form-item label="isOpen"  name="isOpen" dataType="number"   :value="formItem.isOpen" />
      <f-form-item label="分类Id"  name="categoryId" dataType="${formField.dataType}"   :value="formItem.categoryId" />
      <f-form-item label="商品Id"  name="goodsId" dataType="${formField.dataType}"   :value="formItem.goodsId" />
      <f-form-item label="公众号Id"  name="weChatId" dataType="${formField.dataType}"   :value="formItem.weChatId" />
      <f-form-item label="配置排序"  name="configSort" dataType="number"   :value="formItem.configSort" />
      <f-form-item label="配置图标"  name="configIcon" dataType="${formField.dataType}"   :value="formItem.configIcon" />
      <f-form-item label="跳转方式"  name="jumpType" dataType="number"   :value="formItem.jumpType" />
      <f-form-item label="是否删除"  name="deleted" dataType="number"   :value="formItem.deleted" />
      <f-form-item label="更新人"  name="updateUser" dataType="${formField.dataType}"   :value="formItem.updateUser" />
      <f-form-item label="更新时间"  name="updateTime" dataType="${formField.dataType}"   :value="formItem.updateTime" />
      <f-form-item label="创建人"  name="createUser" dataType="${formField.dataType}"   :value="formItem.createUser" />
      <f-form-item label="创建时间"  name="createTime" dataType="${formField.dataType}"   :value="formItem.createTime" />
    </f-form>
  </div>
</template>
<script>
  import api from './js/api'
  export default {
    name: 'configForm',
    props: {},
    data() {
      return {
        refs:this.$refs,
        api:  Object.assign(api, this.api),
        isAdd: true,//是否是添加模式
        loaded: false,//是否加载完成
        formItem: this.getFormItem()
      }
    },
    methods: {
      getFormItem() {
        return {
          configId: '',
          configName: '',
          configImg: '',
          content: '',
          pathUrl: '',
          configCode: '',
          remark: '',
          isOpen: '',
          categoryId: '',
          goodsId: '',
          weChatId: '',
          configSort: '',
          configIcon: '',
          jumpType: '',
          deleted: '',
          updateUser: '',
          updateTime: '',
          createUser: '',
          createTime: ''
        }
      },
      //表单赋值
      setData(data) {
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        if (data && data.configId) {
          let params={
              configId:data.configId
          }
          this.refs['form'].getDetails(params,(data)=>{
             this.formItem=data
             this.loaded = true
          })
          this.isAdd = false
        } else {
          this.loaded = true
        }
      },
      //提交表单
      handleSubmit(callback) {
        this.$refs.form.submit({  }, callback)
      }
    },
    created() {
    },
    components: {}
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
